<?php defined('_JEXEC') or die('Restricted access'); 
JHTML::_('behavior.tooltip');
jimport('joomla.filesystem.file');
$document =& JFactory::getDocument();
$lang =& JFactory::getLanguage();

$document->setDescription( JText::_('My Short List') );
$document->setMetadata('keywords', JText::_('My Short List'));

$component = JComponentHelper::getComponent( 'com_properties' );
$params = new JParameter( $component->params );
$ActivarMapa=$params->get('ActivarMapa');
$currencyformat=$params->get('FormatPrice');
$PositionPrice=$params->get('PositionPrice');
$SimbolPrice=$params->get('SimbolPrice');


?>


<div id="propiedades" >
<h3><?php echo JText::_('My Short List');?></h3>

<?php
$user =& JFactory::getUser();

if(!$user->id){
echo '<b>'.JText::_('Need Login to view your Short List').'</b><br><br></div>';

}
else{
if(!$this->items){echo '<b>'.JText::_('Empty Short List');}
?>
<div id="accordion">
<div id="ShowOrderBy">
<?php require_once( JPATH_COMPONENT.DS.'helpers'.DS.'orderby.php' );?>
</div>
<form action="index.php?option=com_properties&controller=property&Itemid=" method="post" name="Form" id="Form">
<input type="hidden" name="task" value="" />
<input type="hidden" name="controller" value="property" />

<?php
    $k = 0;
	for ($i=0, $n=count( $this->items ); $i < $n; $i++)	
    {
$row = &$this->items[$i];	
	
		$link 		= JRoute::_( 'index.php?option=com_properties&view=property&cid='.$row->Cslug.'&id='.$row->Pslug.'&Itemid='.$this->Itemid->id);
		?>
<div class="producto" >        
    
         
         
<?php
$watermark='DETAILS_MARKET'.$row->available.'-'.$lang->getTag().'.png';

if($row->image1!=NULL){ $img=$row->image1;}else{$img='noimage.jpg';}
$destino_imagen = JPATH_SITE.DS.'images'.DS.'properties'.DS.'peques'.DS.'peque_'.$img;
if (JFile::exists($destino_imagen)){



$InfoImage=getimagesize($destino_imagen);               
                $width=$InfoImage[0];
                $height=$InfoImage[1];
				
	//echo	$width.$height;

$imgTag='<img src="images/properties/peques/peque_'. $img .'" alt="'. $row->name .'" height="75" />';
 
 }else{$imgTag='<img src="images/properties/peques/peque_'. $img .'" />';}
?>
<div class="detalles">
<div class="imagendetalles">
<div class="watermark_box">
<a href="<?php echo $link; ?>">
<?php echo $imgTag;?>
<img src="<?php echo JURI::base().'/components/'.'com_properties/'.'includes/'.'img/'.$watermark; ?>" class="watermark" alt="<?php echo JText::_('DETAILS_MARKET'.$row->available); ?>">
</a>
 </div>
</div>
            	<div class="datos">
<a href="<?php echo $link; ?>"><?php echo $row->name; ?></a><br />
<?php echo JText::_('Category'); ?>: <?php echo $this->NameCategory[$row->parent]; ?><br />
<?php echo JText::_('Type'); ?>: <?php echo $this->NameType[$row->type]; ?><br />
<?php echo JText::_('Country'); ?>: <?php echo $this->NameCountry[$row->cyid]; ?><br />
<?php echo JText::_('State'); ?>: <?php echo $this->NameState[$row->sid]; ?><br /> 
<?php echo JText::_('Locality'); ?>: <?php echo $this->NameLocality[$row->lid]; ?><br /> 
			   </div>
 </div> 
<div class="togagent" style="">

<?php
$imgAgent=1;
 if($imgAgent){
?>
<div class="agent" style=""><img src="images/properties/profiles/<?php echo $row->logo_image_profile;?>" width="140" height="45" /></div>
<?php }?>  
   
<div style=" margin-top:2px; float:left; width:30px; height:36px;">
<a href="<?php echo JRoute::_( 'index.php?option=com_properties&view=shortlist&task=removelightboxProperty&id='.$row->id);?>" title="<?php echo JText::_('Remove this property from my List Short'); ?>">
<img src="<?php echo JURI::base().'components/com_properties/includes/img/delete.png';?>" />
</a>
</div>
<div class="toggler" style=""></div>  
</div>
            
					<div class="element">
                    	<div class="innerelement">

<?php 
$destino_imagen = JPATH_SITE.DS.'images'.DS.'properties'.DS.'peques'.DS.'peque_';

if($row->image2!=NULL & JFile::exists($destino_imagen.$row->image2)){ 
$img=$row->image2;?>
<a href="images/properties/<?php echo $img; ?>" rel="mediabox[680 530]" title="<?php echo $row->name; ?>" >
<img width="90px" height="65px" src="images/properties/peques/peque_<?php echo $row->image2; ?>" alt="<?php echo $row->name; ?>"/></a>
<?php }

if($row->image3!=NULL & JFile::exists($destino_imagen.$row->image3)){ 
$img=$row->image3;?>
<a href="images/properties/<?php echo $img; ?>" rel="mediabox[680 530]" title="<?php echo $row->name; ?>" >
<img width="90px" height="65px" src="images/properties/peques/peque_<?php echo $row->image3; ?>" alt="<?php echo $row->name; ?>"/></a>
<?php }

if($row->image4!=NULL & JFile::exists($destino_imagen.$row->image4)){ 
$img=$row->image4;?>
<a href="images/properties/<?php echo $img; ?>" rel="mediabox[680 530]" title="<?php echo $row->name; ?>" >
<img width="90px" height="65px" src="images/properties/peques/peque_<?php echo $row->image4; ?>" alt="<?php echo $row->name; ?>"/></a>
<?php }

if($row->image5!=NULL & JFile::exists($destino_imagen.$row->image5)){ 
$img=$row->image5;?>
<a href="images/properties/<?php echo $img; ?>" rel="mediabox[680 530]" title="<?php echo $row->name; ?>" >
<img width="90px" height="65px" src="images/properties/peques/peque_<?php echo $row->image5; ?>" alt="<?php echo $row->name; ?>"/></a>
<?php }

if($row->image6!=NULL & JFile::exists($destino_imagen.$row->image6)){ 
$img=$row->image6;?>
<a href="images/properties/<?php echo $img; ?>" rel="mediabox[680 530]" title="<?php echo $row->name; ?>" >
<img width="90px" height="65px" src="images/properties/peques/peque_<?php echo $row->image6; ?>" alt="<?php echo $row->name; ?>"/></a>
<?php }?>



<div class="detalleProducto" style="width:50%; float:left;">
      
<?php
if($row->price!=0){
$number = $row->price;
		if ($currencyformat==0) {
			$formatted_price = number_format($number);
		} else if ($currencyformat==1) {
			$formatted_price = number_format($number, 2,".",",");
		} else if ($currencyformat==2) {
			$formatted_price = number_format($number, 0,",",".");
		} else if ($currencyformat==3) {			
			$formatted_price = number_format($number, 2,",",".");
		}
if($PositionPrice==0){
echo JText::_('Price'); ?>: <?php echo $SimbolPrice.' '. $formatted_price; 
}else{
echo JText::_('Price'); ?>: <?php echo $formatted_price .' '. $SimbolPrice;
}
echo '<br />';
}
?>

<?php if($row->adress){echo JText::_('Adress') .' : '. $row->adress.'<br />';} ?>
<?php if($row->years){echo JText::_('Years') .' : '. $row->years.'<br />';} ?>
<?php if($row->bedrooms){echo JText::_('Bedrooms') .' : '. $row->bedrooms.'<br />';} ?>
<?php if($row->bathrooms){echo JText::_('Bathrooms') .' : '. $row->bathrooms.'<br />';} ?>
<?php if($row->garage){echo JText::_('Garage') .' : '. $row->garage.'<br />';} ?>
<?php if($row->area){echo JText::_('Total Area') .' : '. $row->area.' '.JText::sprintf('Simbol Metric').'<br />';} ?>
<?php if($row->covered_area){echo JText::_('Covered Area') .' : '. $row->covered_area.' '.JText::sprintf('Simbol Metric').'<br />';} ?>
<?php if($row->available){echo JText::_('DETAILS MARKET').' : '.JText::_('DETAILS_MARKET'.$row->available).'<br />';} ?>
<br />
</div>
<div class="detalleProducto" style="width:50%; float:left;">
<?php echo $row->description; ?><br />
                 
<br />
<?php
$rutaG= JURI::base().'index.php?option=com_properties&controller=googlemap&task=map&tmpl=component&id='.$row->id;
$rutaA= JURI::base().'index.php?option=com_properties&task=agentlisting&aid='.$row->agent_id;
if($ActivarMapa == 1){
?>
<a href="<?php echo JRoute::_( $rutaG );?>" rel="mediabox[690 510]" title="<?php echo $row->name; ?>" ><?php echo JText::_('See in map'); ?></a><br />
<?php }?>

<a href="<?php echo JRoute::_( $rutaA );?>"><?php echo JText::_('See Properties for this Agent'); ?></a><br />
</div>   

                </div><!--innerelement-->
                    </div><!-- element-->
</div>  <!--producto -->   
<?php
$k = 1 - $k;
}
 ?>

</form>
</div><!-- acordeon-->
<div id="pagination" style="">

<div id="pagination" style="">

<?php require_once( JPATH_COMPONENT.DS.'helpers'.DS.'pagelinks.php' );?>
      
<div style="clear: both;"></div> 
</div><!-- paginacion-->   
      
<div style="clear: both;"></div> 
</div><!-- paginacion--> 



<div id="tareas">



<?php
$user =& JFactory::getUser();
if(JRequest::getVar('start')){$_start = '&amp;start='.JRequest::getVar('start');}
if(JRequest::getVar('limitstart')){$_limitstart = '&amp;limitstart='.JRequest::getVar('limitstart');}


$ruta= 'index.php?option=com_properties&amp;view=properties&amp;layout=default_print&amp;tmpl=component&amp;ShortList='.$user->id.$_start.$_limitstart;
$status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=600,height=600,directories=no,location=no';?>
<span class="editlinktip hasTip" title="<?php echo JText::_('Print'); ?>::<?php echo str_replace('"',' ',$row->name); ?>">
<a href="javascript:void(0)" onclick="window.open('<?php echo $ruta; ?>','win2','<?php echo $status; ?>');" >
<?php echo JText::_('Print this page'); ?></a>
</span>

<br />
</div>



</div><!-- propiedades-->

<?php

}

/*
echo '<pre>';
print_r($row);
echo '</pre>';
*/
?>